import _ from 'lodash';

const org = {
  state: {
    orgList: []
  },
  mutations: {
    setOrgList (state, orgList) {
      state.orgList = orgList;
    }
  },
  actions: {
    loadRootOrg (context) {
      setTimeout(() => {
        const data = [
          {
            id: '0001',
            title: '奥维云网',
            loading: false,
            children: []
          }
        ];
        context.commit('setOrgList', data);
      }, 1000);
    }
  },
  getters: {
    selected: state => {
      return state.orgList.filter(org => org.selected);
    }
  }
};

export default org;
